package cn.wolfcode.trip.base.domain;


import cn.wolfcode.trip.base.util.JSONUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.*;

@Getter@Setter@ToString
@JsonIgnoreProperties({"handler"})
public class StrategyUserComment extends BaseDomain{
    public static final Boolean READ_ALREADY=true;//已读
    public static final Boolean READ_UNREAD=false;//未读

    //点评
    private StrategyComment strategyComment;

    //评论人
    private User user;

    private String content;

    private Boolean read=READ_UNREAD;

    private List<StrategyReplyUserComment> replyUserComments =new ArrayList<StrategyReplyUserComment>();
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GTM+8")
    private Date createTime;




    public Object getJson(){
        Map<String,Object> map = new HashMap<>();
        if (user != null) {
            map.put("replyUserId",user.getId());
        }
        if (strategyComment != null) {
            map.put("strategyCommentId",strategyComment.getId());
        }
            map.put("strategyUserCommentId",id);

        return JSONUtil.toJSONString(map);
    }

}